<?php
//This view is creating a table, showing gif-images of exercises.

echo heading("Exercises",2);

$TABLE = array();

//Shows gif's if there are any in the database.
if (count($results))
    {
	foreach ($results as $id => $exercise)
        {
            $string = $exercise->exercise_name;
            $string .= br();

            $properties = array(
                                    'src' => $exercise->exercise_gif,
                                    'width' => '200',
                                    'height' => '180'
            );
            $string .= img($properties,true);

            $properties = array();
            $string .= br(2);


            $TABLE[] = $string;
    }

    //Arrange the table so it looks nice and pretty.
    $tmpl = array (
            'table_open'  => "<table class='grid'>",
            'row_start'   => "<tr valign='top'>",
    );
    $this->table->set_template($tmpl);
    $this->table->set_empty("&nbsp;");
    $pretty = $this->table->make_columns($TABLE,3);

    echo $this->table->generate($pretty);



}else{
	echo "Sorry, no search results matched that query!";
}


